package com.yyfax.pay.third.model.to.fuiou.xml;

import java.io.StringWriter;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.io.xml.QNameMap;
import com.thoughtworks.xstream.io.xml.StaxDriver;
import com.thoughtworks.xstream.io.xml.StaxWriter;

@XStreamAlias("FM")
public class CardBinReq {
	/**
	 * 商户代码
	 */
	@XStreamAlias("MchntCd")
	private String mchntcd;

	/**
	 * 银行卡号
	 */
	@XStreamAlias("Ono")
	private String oNo;

	/**
	 * q签名
	 */
	@XStreamAlias("Sign")
	private String sign;

	public String getMchntcd() {
		return mchntcd;
	}

	public void setMchntcd(String mchntcd) {
		this.mchntcd = mchntcd;
	}

	public String getoNo() {
		return oNo;
	}

	public void setoNo(String oNo) {
		this.oNo = oNo;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String toXml() {
		QNameMap qmap = new QNameMap();
		qmap.setDefaultPrefix("");
		StaxDriver staxDriver = new StaxDriver(qmap);
		XStream xstream = new XStream(staxDriver);
		xstream.autodetectAnnotations(true);
		xstream.ignoreUnknownElements();
		xstream.alias("REQUEST", OrderReqData.class);
		try {
			StringWriter strWriter = new StringWriter();
			StaxWriter sw = new StaxWriter(staxDriver.getQnameMap(), staxDriver.getOutputFactory().createXMLStreamWriter(strWriter), false, true);
			xstream.marshal(this, sw);
			sw.close();
			// return "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + strWriter.toString();
			return strWriter.toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
